/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Kelompok3
 * 
 */
@Entity
@Table(name = "events", catalog = "onick", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"),
    @NamedQuery(name = "Event.findByIdEvent", query = "SELECT e FROM Event e WHERE e.idEvent = :idEvent"),
    @NamedQuery(name = "Event.findByNamaEvent", query = "SELECT e FROM Event e WHERE e.namaEvent = :namaEvent"),
    @NamedQuery(name = "Event.findByDeskripsi", query = "SELECT e FROM Event e WHERE e.deskripsi = :deskripsi"),
    @NamedQuery(name = "Event.findByTempat", query = "SELECT e FROM Event e WHERE e.tempat = :tempat"),
    @NamedQuery(name = "Event.findByTanggal", query = "SELECT e FROM Event e WHERE e.tanggal = :tanggal"),
    @NamedQuery(name = "Event.findByGambar", query = "SELECT e FROM Event e WHERE e.gambar = :gambar"),
    @NamedQuery(name = "Event.findByHargaTiket", query = "SELECT e FROM Event e WHERE e.hargaTiket = :hargaTiket"),
    @NamedQuery(name = "Event.findByRekening", query = "SELECT e FROM Event e WHERE e.rekening = :rekening"),
    @NamedQuery(name = "Event.findByTeleponCP", query = "SELECT e FROM Event e WHERE e.teleponCP = :teleponCP")})
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_EVENT", nullable = false)
    private Integer idEvent;
    @Column(name = "NAMA_EVENT", length = 100)
    private String namaEvent;
    @Column(name = "DESKRIPSI", length = 100)
    private String deskripsi;
    @Column(name = "TEMPAT", length = 100)
    private String tempat;
    @Column(name = "TANGGAL", length = 20)
    private String tanggal;
    @Column(name = "GAMBAR", length = 100)
    private String gambar;
    @Column(name = "HARGA_TIKET")
    private Integer hargaTiket;
    @Column(name = "REKENING", length = 100)
    private String rekening;
    @Column(name = "TELEPON_C_P", length = 50)
    private String teleponCP;
    @OneToMany(mappedBy = "idEvent", fetch = FetchType.LAZY)
    private List<Comment> commentList;
    @OneToMany(mappedBy = "idEvent", fetch = FetchType.LAZY)
    private List<HistoryPayment> historyPaymentList;
    @JoinColumn(name = "ID_USER", referencedColumnName = "ID_USER")
    @ManyToOne(fetch = FetchType.LAZY)
    private User idUser;
    
    public Event() {
    }

    public Event(Integer idEvent) {
        this.idEvent = idEvent;
    }

    public Integer getIdEvent() {
        return idEvent;
    }

    public void setIdEvent(Integer idEvent) {
        this.idEvent = idEvent;
    }

    public String getNamaEvent() {
        return namaEvent;
    }

    public void setNamaEvent(String namaEvent) {
        this.namaEvent = namaEvent;
    }

    public String getDeskripsi() {
        return deskripsi;
    }

    public void setDeskripsi(String deskripsi) {
        this.deskripsi = deskripsi;
    }

    public String getTempat() {
        return tempat;
    }

    public void setTempat(String tempat) {
        this.tempat = tempat;
    }

    public String getTanggal() {
        return tanggal;
    }

    public void setTanggal(String tanggal) {
        this.tanggal = tanggal;
    }

    public String getGambar() {
        return gambar;
    }

    public void setGambar(String gambar) {
        this.gambar = gambar;
    }

    public Integer getHargaTiket() {
        return hargaTiket;
    }

    public void setHargaTiket(Integer hargaTiket) {
        this.hargaTiket = hargaTiket;
    }

    public String getRekening() {
        return rekening;
    }

    public void setRekening(String rekening) {
        this.rekening = rekening;
    }

    public String getTeleponCP() {
        return teleponCP;
    }

    public void setTeleponCP(String teleponCP) {
        this.teleponCP = teleponCP;
    }

    @XmlTransient
    public List<HistoryPayment> getHistoryPaymentList() {
        return historyPaymentList;
    }

    public void setHistoryPaymentList(List<HistoryPayment> historyPaymentList) {
        this.historyPaymentList = historyPaymentList;
    }

    public User getIdUser() {
        return idUser;
    }

    public void setIdUser(User idUser) {
        this.idUser = idUser;
    }

    @XmlTransient
    public List<Comment> getCommentList() {
        return commentList;
    }

    public void setCommentList(List<Comment> commentList) {
        this.commentList = commentList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEvent != null ? idEvent.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Event)) {
            return false;
        }
        Event other = (Event) object;
        if ((this.idEvent == null && other.idEvent != null) || (this.idEvent != null && !this.idEvent.equals(other.idEvent))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Event[ idEvent=" + idEvent + " ]";
    }
    
}
